package springapp.service;

import java.util.Set;

import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;

public class Cache<K, V> implements ICache<K, V> {

	private BiMap<K, V> cache = HashBiMap.create();

	public V getValueForKey(K key) {
		return this.cache.get(key);
	}

	public K getKeyForValue(V value) {
		return this.cache.inverse().get(value);
	}

	public void put(K key, V value) {
		this.cache.put(key, value);
	}
	
	public Set<V> getValues(){
		return this.cache.values();
	}

}
